<?php
$num1=$_GET["num1"];
$num2=$_GET["num2"];
$op=$_GET["op"];

switch ($op){
    case '+':$result=$num2+$num2;break;
    case '-':$result=$num2+$num2;break;
    case '*':$result=$num2+$num2;break;
    case '%':$result=$num2+$num2;break;
}
?>

<html>
<body>
<form action="cal.php" method="get">
    <input type="text" name="num1" value="<?php echo $num1?>" />
    <select name="op">
        <option value="+" <?php echo $op=='+'?'selected':''?>>+</option>
        <option  value="-" <?php echo $op=='-'?'selected':''?>>-</option>
        <option value="*" <?php echo $op=='*'?'selected':''?>>*</option>
        <option value="%" <?php echo $op=='%'?'selected':''?>>%</option>
    </select>
    <input type="text" name="num2" value="<?php echo $num2?>" />
    =
    <input type="text" name="result" />
    <button type="submit">计算</button>
</form>
</body>
</html>


